﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Comom.Project.ControllerCom;
using Dhtl.Service.IService;
using dai_hoc_tuong_lai.Areas.Admin.Models;

namespace dai_hoc_tuong_lai.Controllers
{
    public class CoursController : UTController
    {
        //
        // GET: /Cours/

        private readonly ICateNganhHoc _iCateNews;
        private readonly INganhHoc _iNews;
        private readonly int PageSize = 15;

        public CoursController(ICateNganhHoc iCateNews, INganhHoc iNews)
        {
            this._iCateNews = iCateNews;
            this._iNews = iNews;
        }

        public ActionResult Index()
        {
            return View();
        }


        public ActionResult _MenuNganhHoc(int parent)
        {
            var listEntity = _iCateNews.ListByParentId(parent);
            List<CateNganhHocModel> model = new List<CateNganhHocModel>();
            try
            {
                foreach (var item in listEntity)
                {
                    CateNganhHocModel ml = new CateNganhHocModel();
                    CateNganhHocModel.MapFrom(item, ref  ml);
                    model.Add(ml);
                }
            }
            catch { }

            ViewBag.parent = parent;

            return PartialView("_MenuNganhHoc", model);
        }
    }
}
